#include <iostream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;

int numWhat;
vector<string> strCout;
vector<string> strCin;
class MenuCode
{
    public:
     void menuOne()
    {
        cout << "1.输入新的字符串" << endl;
        cout << "2.显示所有字符串" << endl;
        cout << "3.显示排序后所有字符串" << endl;
        cout << "4.退出程序" << endl;
    }
    
     void mStrsort(vector<string> & str )
    {
        int len = str.size();
        for ( int j = 0 ; j < len ; j++)
        {
            for ( int i = 0 ; i < len-j-1 ; i++)
        {
                if (str[i].compare( str[i+1]) > 0 )
                swap( str[i] , str [i+1] );
             

        }
        }

       
    }
    
    
      auto menuOp(int numOne)
    {
       
        if ( numOne == 1 )
        {
            string x;
            cout << "请输入字符串:" ;
            while (cin >> x)
	        {
		        strCin.push_back(x);
		        if (cin.get()=='\n')
		        break;
	        }
            
            strCout=strCin;
            mStrsort(strCout);
            




                
        }
   
        else if ( numOne == 2 )
            {
                int len = strCin.size();
                for ( int i = 0 ; i <= len-1 ; i++)
                cout << i+1 << "." << strCin[i] << endl;
                       
             
            }

            
        else if ( numOne == 3 )
            {
                int len = strCout.size();
                for ( int i = 0 ; i <= len-1 ; i++)
                cout << i+1 << "." << strCout[i] << endl;
            
                
            }
        else if ( numOne == 4 )
            return 0;
            
    }
     
    
    
};

int main()
{
    MenuCode menuCode;
    while (/* contruedition */true)
    {
       menuCode.menuOne();
    cin >> numWhat;
    menuCode.menuOp( numWhat );
    if (numWhat == 4)
    break;

    }
    
    




    return 0;
}
